fix: Remove default content-length header from MultipartStreamBuilder class #63
+12
−12
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What's in this PR?
Remove default
Content-Length
header from MultipartStreamBuilder class.Why?
Content-Length
in multipart bodies is not necessary. Some legacies system can't manage the "Content-Length" header into "multipart/form-data" boundary and cut off the request.Currently I had face this problem with Azure OpenAI upload files API.
For reference see the RFC 7578 in section 4.8 which specify:
4.8. Other "Content-" Header Fields
The multipart/form-data media type does not support any MIME header
fields in parts other than Content-Type, Content-Disposition, and (in
limited circumstances) Content-Transfer-Encoding. Other header
fields MUST NOT be included and MUST be ignored.
Older system are not compliant because not apply the MUST be ignore policy but on the other side this code non apply the MUST NOT be included policy. So the Azure OpenAI API server is designed to be RFC compliant.
Example Usage
N/A
Checklist